﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Project.Model;
using Project.DAL;
using MVC_Project.BLL;

namespace Project.BLL
{
    public class DDmanageBll : BaseBll<DDmanage>
    {
        DDmanageDal dal = new DDmanageDal();
        public override void SetDal()
        {
            Dal = new DDmanageDal();
        }
        public List<DDmanage> GetDDmanage()
        {
            return base.Query().ToList();
        }
        public bool DeleteDDmanage(int id)
        {
            dal.delectdan(id);

            var ddmanage = Dal.Query().Where(u => u.id == id).FirstOrDefault();


            if (ddmanage != null)
            {
                Dal.Delete(ddmanage);
                return Dal.SaveChanges();
            }

            else
            {
                return false;
            }
        }
        public bool DeleteDDAll(int[] id)
        {
            dal.delectduo(id);

            var ddmanage = Dal.Query().Where(u => id.Contains(u.id)).ToList();
            if (ddmanage != null)
            {
                Dal.Delete(ddmanage);
                return Dal.SaveChanges();
            }
            else
            {
                return false;
            }
        }
    }
}
